package jmcnet.libcommun.communs.composants
{
	import com.google.maps.Map;
	import com.rubenswieringa.book.Page;
	
	import flash.display.BitmapData;
	import flash.display.IBitmapDrawable;
	
	public class GoogleMapsPage extends Page
	{
		private var _map:Map=null;
		
		public function GoogleMapsPage()
		{
			super();
		}
		
		public function set map(map:Map):void { _map = map;}
		
	   /**
		* Draws itself on a BitmapData instance and returns it.
		* 
		* @return	BitmapData
		*/
		override public function getBitmapData ():BitmapData {
			var bmd:BitmapData = new BitmapData(this.width, this.height, true, 0x00ffffff);
			// JMC pour eviter les pb avec GoogleMaps qui refuse de tourner une page qui a une carte...
			try {
				bmd.draw(this);
			} catch (e:Error) {
				trace("Error during getBitmapData in Page : "+e.message);
				if (_map != null) bmd = _map.getPrintableBitmap().bitmapData;
			}
			return bmd;
		}
	}
}